﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MMDemo
{
    class NewLinkData:InterfaceNewData
    {
        public bool NewData()
        {
            switch(GlobalLink.operateType)
            {
                case LinkOperateType.InitNew:
                    NewInitData(); break;
                case LinkOperateType.AddElement:
                    NewAddData(); break;
                case LinkOperateType.Delete:
                    NewDeleteData(); break;
                case LinkOperateType.Search:
                    NewSearchData(); break;
            }
            return PublicDataClass.IsInit;
        }
        private void NewInitData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();
        }
        private void NewAddData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();

            LinearInsertForm idf = new LinearInsertForm();
            idf.ShowDialog();

            LinearLocateForm lcf = new LinearLocateForm();
            lcf.ShowDialog();
        }
        private void NewDeleteData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();

            LinearLocateForm lcf = new LinearLocateForm();
            lcf.ShowDialog();
        }
        private void NewSearchData()
        {
            LinearInitForm ndf = new LinearInitForm();
            ndf.ShowDialog();

            LinearSearchForm fef = new LinearSearchForm();
            fef.ShowDialog();
        }

        public void ShowForm(SysDemoForm demof, SysArithmeticForm arif, int Width, int Height)
        {
            demof.Top = 0;
            demof.Left = 0;
            demof.Width = Width * 3 / 5;
            demof.Height = Height;
            demof.Show();

            arif.Top = 0;
            arif.Left = Width * 3 / 5;
            arif.Width = Width * 2 / 5;
            arif.Height = Height;
            arif.Show();
        }
    }
}
